CC = gcc
CFLAGS = -g -MMD -MP 
SRCS := $(wildcard *.c)
OBJS := $(SRCS:.c=.o)
DEPS := $(SRCS:.c=.d)  

run: test check
	@ bash -c "export LD_PRELOAD=../libsetjmp_hok.so && ./test"


check:
	@if ! [ -f ../libsetjmp_hok.so ]; then \
        echo "\033[31m文件libsetjmp_hok.so缺失,强制退出\033[0m"; \
        exit 1; \
    fi						


all: test


test: $(OBJS)
	$(CC) $(CFLAGS)  $< -o $@

-include $(DEPS)


%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f test $(OBJS) $(DEPS)
